package WaiBao;

import java.util.Arrays;

public class ShuangZiYi {
    public static void main(String[] args) {
        String[] name = {"王一凡(班长)","李志远(团支书)", "小李(学习委员)","李亚文(文艺委员)", "张发花", "李存勖", "李天乐", "李星云", "候清", "佟大为", "赵鬼才", "赵静静",
                "王丽", "王静", "管虎", "七月", "安生", "沈腾", "玛丽", "马力", "马黎", "李文混", "李光明", "小天", "小王", "小罗", "耿耿", "余淮",
                "易烊千玺", "双紫怡(学生)"};//考生本人: 双紫怡(学生)
        int[] age = {20, 18, 18, 17, 19, 20, 19, 21, 19, 19, 18, 18, 18, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 20, 18, 18, 18};//最后一位：考生年龄:18
//        for (int i = 0; i < name.length; i++) {
//            System.out.println("姓名:"+name[i]+" "+"年龄:"+age[i]);
//        }

        double[] SCO1 = {88, 62, 76, 94, 97, 79, 78, 89, 81, 90, 91, 87, 85, 79, 65, 68, 99, 99, 96, 88, 92, 91, 95, 65, 75, 74, 94, 74, 88, 94};
        double[] SCO2 = {77, 65, 75, 96, 88, 67, 58, 69, 70, 90, 90, 77, 66, 85, 65, 65, 76, 99, 66, 98, 72, 71, 95, 86, 75, 88, 84, 64, 80, 95};
        double[] SCO3 = {92, 67, 84, 85, 75, 64, 78, 69, 80, 80, 93, 87, 85, 65, 65, 68, 69, 96, 96, 93, 92, 81, 65, 95, 76, 84, 73, 71, 89, 95};


        double dudu ;//代表每个学生的总分
        double heihei;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            dudu  = SCO1[i] + SCO2[i] + SCO3[i];
//            heihei= (dudu * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + dudu);
//            System.out.println(name[i] + "的平均分为:" + heihei);
//        }


//        double DD = 0,HEIHEI = 0;
//        double[] JIEGUO = new double[30];
//        for (int i = 0; i < 30; i++) {
//            DD = SCO1[i] + SCO2[i] + SCO3[i];
//            HEIHEI= (DD* 1.0) / 3;
//            JIEGUO [i] = HEIHEI;
//        }
//
//        for (int i = 0; i <  JIEGUO .length - 1; i++) {
//            for (int j = 0; j <  JIEGUO .length - i - 1; j++) {
//                if (JIEGUO [j] < JIEGUO [j + 1]) {
//                    double tep =  JIEGUO [j];
//                    JIEGUO [j] = JIEGUO [j + 1];
//                    JIEGUO [j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println( JIEGUO [i]);
//        }



        double ET1 = 0, ET2 = 0, ET3 = 0;//计算每门课的平均分
        double EY1 = 0, EY2 = 0, EY3 = 0;//计算每门课标准差
        double MQ1 = 0, MQ2 = 0, MQ3 = 0;//计算每门课中位数
        double he = 0;
        for (int i = 0; i < SCO1.length; i++) {
            he += SCO1[i];
        }
        ET1 = (he * 1.0) / 30;
        System.out.println("农业设施及环境调控的班级平均分为:" +ET1);
        double Sum = 0;
        for (int i = 0; i < SCO2.length; i++) {
            Sum +=SCO2[i];
        }
        ET2 = (Sum * 1.0) / 30;
        System.out.println("农业设施设计与建造的班级平均分为:" + ET2);
        double sum = 0;
        for (int i = 0; i < SCO3.length; i++) {
            sum += SCO3[i];
        }
        ET3 = (sum * 1.0) / 30;
        System.out.println("园艺植物设施栽培学的班级平均分为:" + ET3);



        double c1 = 0, c2 = 0, c3 = 0;
        for (int i = 0; i <SCO1.length; i++) {
            c1 += (SCO1[i] - ET1) * (SCO1[i] - ET1);
        }
        EY1 = Math.sqrt(c1*1.0/30);
        System.out.println("农业设施及环境调控的班级标准差为:" + EY1);
        for (int i = 0; i < SCO2.length; i++) {
            c2 += (SCO2[i] - ET2) * (SCO2[i] -ET2);
        }
        EY2 = Math.sqrt(c2*1.0/30);
        System.out.println("农业设施设计与建造的班级标准差为:" +EY2);

        for (int i = 0; i <SCO3.length; i++) {
            c3 += (SCO3[i] - ET3) * (SCO3[i] - ET3);
        }
        EY3 = Math.sqrt(c3*1.0/30);
        System.out.println("园艺植物设施栽培学的标准差为:" + EY3);
////
//        Arrays.sort(SCO1);
//        Arrays.sort(SCO2);
//        Arrays.sort(SCO3);
//        MQ1 = (SCO1[15] + SCO2[14]) * 1.0 / 2;
//        MQ2 = (SCO2[15] +SCO2[14]) * 1.0 / 2;
//        MQ3 = (SCO3[15] + SCO3[14]) * 1.0 / 2;
//        System.out.println("农业设施及环境调控的中位数为:" +  MQ1);
//        System.out.println("农业设施设计与制造的中位数为:" +  MQ2);
//        System.out.println("园艺植物设施栽培学的中位数为:" +  MQ3);


    }
}
